# = test.photo.14.rb -  Photo Gallery Page Test
# 
# See LICENSE.txt for licensing details.
#
# == Description Here the links and text on the "All Galleries Page" are tested and verified 
require 'watir'
include Watir
require 'test/unit'
require '../watir.config.rb'
    
	class TC_ForumRss_test < Test::Unit::TestCase
    
    def startup      
      @@ie = Watir::IE.start($SITE_URL)
	  end
	
	  def ie
      if defined? @@ie
        @@ie
      else
        startup
      end
	  end
    
    def test_01_verifyHomeText
        assert(ie.contains_text(/Community Server/))		
    end
      
    def test_02_verifyLoginLinksExist
      if !(ie.link(:text, 'Sign in').exists?)
        ie.goto($SITE_URL + 'logout.aspx')
        ie.refresh
        ie.goto($SITE_URL)
        ie.refresh
      end
	  end
    
    def test_03_navigateToPhotosPage
      assert(ie.link(:text, "Photos").exists?)
      ie.link(:text, "Photos").click
    end
    
    def test_04_verifyLinksOnPhotosPage
      assert(ie.link(:text, 'Sign in').exists?)
      assert(ie.link(:text, 'Join').exists?)
      assert(ie.link(:text, 'Help').exists?)
      assert(ie.button(:id, /TitleBarSearchButton$/).exists?)
      assert(ie.link(:text, 'Home').exists?)
      assert(ie.link(:text, 'Blogs').exists?)
      assert(ie.link(:text, 'Forums').exists?)
      assert(ie.link(:text, 'Photos').exists?)
      assert(ie.link(:text, 'Downloads').exists?)
      assert(ie.link(:text, 'All Galleries').exists?)
    end
    
    def test_06_navigateToAllGalleries
      assert(ie.link(:text, 'All Galleries').exists?)
      ie.link(:text, 'All Galleries').click
    end
    
    def test_07_verifyLinksOnAllGalleriesPage
      assert(ie.link(:text, 'Sign in').exists?)
      assert(ie.link(:text, 'Join').exists?)
      assert(ie.link(:text, 'Help').exists?)
      assert(ie.link(:text, 'Home').exists?)
      assert(ie.link(:text, 'Blogs').exists?)
      assert(ie.link(:text, 'Forums').exists?)
      assert(ie.link(:text, 'Photos').exists?)
      assert(ie.link(:text, 'Downloads').exists?)
      #assert(ie.link(:text, 'My Reader').exists?)
      assert(ie.link(:text, 'Wildlife').exists?)
      assert(ie.link(:text, 'Sample').exists?)
      assert(ie.link(:text, 'Browse All Tags').exists?)
    end
    
    def test_09_verifyTextOnAllGalleriesPage
      assert(ie.contains_text("All Galleries"))
      assert(ie.contains_text("Sample Photo Galleries"))
      assert(ie.contains_text("Gallery"))
      assert(ie.contains_text("Last Changed"))
      assert(ie.contains_text("Photo Count"))
    end
    
  end